package com.ciis.system.authority.service.impl;

import com.ciis.system.authority.domain.TSysAuthority;
import com.ciis.system.authority.mapper.ITSysAuthorityMapper;
import com.ciis.system.authority.service.ISysAuthorityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created with IntelliJ IDEA.
 * User: zhangdajun
 * Date: 14-5-31
 * Time: 上午10:29
 * To change this template use File | Settings | File Templates.
 */
@Service("authorityService")
public class SysAuthorityServiceImpl implements ISysAuthorityService {

    @Autowired
    ITSysAuthorityMapper authorityMapper;

    @Override
    public void save(TSysAuthority authority) throws Exception {
        authorityMapper.save(authority);
    }

    @Override
    public void update(TSysAuthority authority) throws Exception {
        authorityMapper.update(authority);
    }

    @Override
    public void delete(String idStr) throws Exception {
        String ids[] = idStr.split(",");
        for(String id : ids){
            authorityMapper.delete(id);
        }
    }

    @Override
    public void deleteByLevel(String level) throws Exception {
        authorityMapper.deleteByLevel(level);
    }
}
